package com.ticket.sass.admin.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ticket.sass.common.entity.tenant.MemberCardEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 会员卡 Mapper 接口
 * </p>
 *
 * @author ywb
 * @since 2024-03-06
 */
public interface MemberCardMapper extends BaseMapper<MemberCardEntity> {
    @Select("""
        SELECT  
            u.id AS user_id,
            u.nickname,
            u.cellphone,
            c.card_number,
            c.balance
        FROM  
             users u
        INNER JOIN
            member_cards c ON u.id = c.user_id ${ew.customSqlSegment}
         """)
    IPage<MemberCardEntity> queryPage(Page<MemberCardEntity> page, @Param(Constants.WRAPPER) QueryWrapper<MemberCardEntity> queryWrapper);
}
